package com.jinsi.service.tang.iml;


import com.jinsi.constant.TangConstant;
import com.jinsi.mapper.tang.MicroCycleReviewMapper;
import com.jinsi.pojo.Comment;
import com.jinsi.service.tang.MicroCycleReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 微圈评论
 * @author 唐文博
 * @Date 2022-09-09
 */
@Service
@Transactional
public class MicroCycleReviewServiceImpl implements MicroCycleReviewService {
    @Autowired
    private MicroCycleReviewMapper microCycleReviewMapper;

    /**
     * 查看课程评论人数和次数
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public int getMicroCycleReview() {
        return microCycleReviewMapper.getMicroCycleReview(TangConstant.COMMENT_MICROCYCLE);
    }

//    /**
//     * 查看微圈评论人数  status1已通过 2已拦截 3已删除
//     * @param status
//     * @return
//     */
//    @Override
//    public int getMicroCycleNumber(Integer status) {
//        return microCycleReviewMapper.getMicroCycleNumber(status,TangConstant.COMMENT_MICROCYCLE);
//    }

    /**
     * 查看今日评论人数和次数
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public int getMicroCycleToday() {
        return microCycleReviewMapper.getMicroCycleToday(TangConstant.COMMENT_MICROCYCLE);
    }

    /**
     * 查看微圈评论列表的成员账号，昵称，所属文章，发言时间，发言内容
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public List<Comment> getReview() {
        return microCycleReviewMapper.getReview(TangConstant.COMMENT_MICROCYCLE);
    }

    /**
     * 查看正常微圈评论列表的成员账号及信息（已通过）
     * @param status
     * @return
     */
    @Override
    @Transactional(readOnly = true)
    public List<Comment> getReviewNormal(Integer status) {
        return microCycleReviewMapper.getReviewNormal(status,TangConstant.COMMENT_MICROCYCLE);
    }

    /**
     * 修改成已拦截状态 //状态 1已通过 2已拦截 3已删除',微圈
     * @param id
     * @param status
     */
    @Override
    public void microCycleReviewBlocked(Integer id, Integer status) {
        microCycleReviewMapper.microCycleReviewBlocked(id, status);
    }

}
